const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')

module.exports = {
  entry:'./src/main.ts',
  output:{
     path:path.resolve(__dirname,'dist'),
     filename:' main.js'
  },
  mode:'development',
  devServer:{
    contentBase:'./dist',
    open:true
  },
  resolve:{
    "extensions":['.ts','.js','.json']
  },
  module:{
    rules:[
      {
        test:/\.css$/,
        use:['style-loader','css-loader']
      },
      {
        test:/\.ts$/,
        use:['ts-loader'],
        exclude:/node_modules/
      },
    ]
  },
  plugins:[
    new HtmlWebpackPlugin({
      template:'./src/index.html',
    }),
    new CleanWebpackPlugin()
  ]
}